package net.lab1024.sa.admin.module.business.purchase.supplier.domain.form;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import net.lab1024.sa.admin.module.business.purchase.supplier.constant.SupplierCreditRatingEnum;
import net.lab1024.sa.admin.module.business.purchase.supplier.constant.SupplierStatusEnum;
import net.lab1024.sa.admin.module.business.purchase.supplier.constant.SupplierTypeEnum;
import net.lab1024.sa.base.common.swagger.SchemaEnum;
import net.lab1024.sa.base.common.validator.enumeration.CheckEnum;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.Email;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;

/**
 * 供应商更新表单
 *
 * @Author 1024创新实验室
 * @Date 2024/07/19 20:30:00
 * @Wechat zhuoda1024
 * @Email lab1024@163.com
 * @Copyright <a href="https://1024lab.net">1024创新实验室</a>
 */
@Data
public class SupplierUpdateForm {

    @Schema(description = "供应商ID", required = true)
    @NotNull(message = "供应商ID不能为空")
    private Long supplierId;

    @Schema(description = "供应商编码", required = true)
    @NotBlank(message = "供应商编码不能为空")
    @Length(max = 50, message = "供应商编码最多50字符")
    private String supplierCode;

    @Schema(description = "供应商名称", required = true)
    @NotBlank(message = "供应商名称不能为空")
    @Length(max = 100, message = "供应商名称最多100字符")
    private String supplierName;

    @SchemaEnum(desc = "供应商类型", value = SupplierTypeEnum.class)
    @CheckEnum(value = SupplierTypeEnum.class, required = true, message = "供应商类型错误")
    private Integer supplierType;

    @Schema(description = "联系人")
    @Length(max = 50, message = "联系人最多50字符")
    private String contactPerson;

    @Schema(description = "联系电话")
    @Pattern(regexp = "^[0-9-]{0,20}$", message = "联系电话格式不正确")
    private String contactPhone;

    @Schema(description = "联系邮箱")
    @Email(message = "邮箱格式不正确")
    @Length(max = 100, message = "邮箱最多100字符")
    private String contactEmail;

    @Schema(description = "地址")
    @Length(max = 200, message = "地址最多200字符")
    private String address;

    @Schema(description = "营业执照号")
    @Length(max = 100, message = "营业执照号最多100字符")
    private String businessLicense;

    @Schema(description = "纳税人识别号")
    @Length(max = 50, message = "纳税人识别号最多50字符")
    private String taxNumber;

    @Schema(description = "银行账号")
    @Length(max = 50, message = "银行账号最多50字符")
    private String bankAccount;

    @Schema(description = "开户银行")
    @Length(max = 100, message = "开户银行最多100字符")
    private String bankName;

    @SchemaEnum(desc = "信用等级", value = SupplierCreditRatingEnum.class)
    @CheckEnum(value = SupplierCreditRatingEnum.class, required = false, message = "信用等级错误")
    private String creditRating;

    @SchemaEnum(desc = "状态", value = SupplierStatusEnum.class)
    @CheckEnum(value = SupplierStatusEnum.class, required = true, message = "状态错误")
    private Integer status;

    @Schema(description = "备注")
    @Length(max = 500, message = "备注最多500字符")
    private String remark;
}